﻿
Imports System.IO
Public Class frmLocaleWeather
    Private m_OnSiteData As New OnSiteMetData
    Property OnSiteData() As OnSiteMetData
        Get
            Return m_OnSiteData
        End Get
        Set(ByVal value As OnSiteMetData)
            m_OnSiteData = value
        End Set
    End Property
   
   
    ''' <summary>
    ''' 在表格中把数据显示出来
    ''' </summary>
    ''' <remarks></remarks>
    Private Sub ShowFlexLocaleWeather()

        Dim bb As Integer = 0
        Dim count As Integer = 0
        Dim time As String = ""
        FlexLocaleWeather.Cols.Count = 3 + 6 * Me.m_OnSiteData.LocaleConcourse.CountTierData
        FlexLocaleWeather.Rows.Count = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length + 1

        For t As Integer = 0 To Me.m_OnSiteData.LocaleConcourse.CountTierData - 1
            count = t * 6

            Me.FlexLocaleWeather.SetData(0, 3 + count, "第" & t + 1 & "层离地" & vbCrLf & "高度[m]")
            Me.FlexLocaleWeather.SetData(0, 4 + count, "第" & t + 1 & "层水平" & vbCrLf & "风向标差[度]")
            Me.FlexLocaleWeather.SetData(0, 5 + count, "第" & t + 1 & "层垂直" & vbCrLf & "风速标差[度]")
            Me.FlexLocaleWeather.SetData(0, 6 + count, "第" & t + 1 & "层" & vbCrLf & "温度[°C]")
            Me.FlexLocaleWeather.SetData(0, 7 + count, "第" & t + 1 & "层" & vbCrLf & "风向[度]")
            Me.FlexLocaleWeather.SetData(0, 8 + count, "第" & t + 1 & "层" & vbCrLf & "风速[m/s]")
        Next

        For i As Integer = 0 To Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length - 1
            Me.FlexLocaleWeather.SetData(i + 1, 0, i + 1)
            time = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Year & "-" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Month & "-" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Day
            Me.FlexLocaleWeather.SetData(i + 1, 1, time)
            Me.FlexLocaleWeather.SetData(i + 1, 2, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Time)
            For j As Integer = 0 To Me.m_OnSiteData.LocaleConcourse.CountTierData - 1
                count = j * 6
                If Me.m_OnSiteData.LocaleConcourse.CountTierData > Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData.Length Then

                Else
                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight = 9999 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight <> 9999 Then
                        Me.FlexLocaleWeather.SetData(i + 1, 3 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight)
                    End If

                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane = -99 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane <> -99 Then

                        Me.FlexLocaleWeather.SetData(i + 1, 4 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane)
                    End If
                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed = 99 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed <> 99 Then
                        Me.FlexLocaleWeather.SetData(i + 1, 5 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed)
                    End If

                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature = -99 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature <> -99 Then
                        Me.FlexLocaleWeather.SetData(i + 1, 6 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature)
                    End If

                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane = -999 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane <> -999 Then
                        Me.FlexLocaleWeather.SetData(i + 1, 7 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane)
                    End If
                    If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed = -999 Then
                    ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed <> -999 Then
                        Me.FlexLocaleWeather.SetData(i + 1, 8 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed)
                    End If

                End If

            Next
        Next
        'FlexLocaleWeather.Width = 70
        'FlexLocaleWeather.
        FlexLocaleWeather.AutoResize = True
        FlexLocaleWeather.AutoSizeCols()
        FlexLocaleWeather.AutoSizeRows()
        Me.FlexLocaleWeather.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.FlexLocaleWeather.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.None
        Me.FlexLocaleWeather.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.FlexLocaleWeather.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
    End Sub


    Private Sub frmLocaleWeather_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.FlexLocaleWeather.Styles.Alternate.BackColor = Color.FromArgb(216, 228, 248)

        '经度

        Me.cobJd.Items.Add("E")
        Me.cobJd.Items.Add("W")
        Me.cobJd.Text = "E"

        '纬度
        Me.cobWd.Items.Add("N")
        Me.cobWd.Items.Add("S")
        Me.cobWd.Text = "N"

        StringHandle.L_openFile = 0
        Me.FlexLocaleWeather.Rows.Count = 1
        Me.FlexLocaleWeather.AutoSizeRows()
        Me.ShowFlex()
    End Sub


    Private Sub ShowFlex()
        If Me.m_OnSiteData.Title.Longitude IsNot Nothing And Me.m_OnSiteData.Title.Latitude IsNot Nothing Then
            Me.txtLongitude.Text = Me.m_OnSiteData.Title.Longitude.Remove(Me.m_OnSiteData.Title.Longitude.Length - 1)
            If Me.m_OnSiteData.Title.Longitude.EndsWith("e") Or Me.m_OnSiteData.Title.Longitude.EndsWith("E") Then
                cobJd.Text = "E"
            Else
                cobJd.Text = "W"
            End If
            Me.txtLatitude.Text = Me.m_OnSiteData.Title.Latitude.Remove(Me.m_OnSiteData.Title.Latitude.Length - 1)
            If Me.m_OnSiteData.Title.Latitude.EndsWith("N") Or Me.m_OnSiteData.Title.Latitude.EndsWith("n") Then
                cobWd.Text = "N"
            Else
                cobWd.Text = "S"
            End If

            Me.txtLongitude.Text = Me.m_OnSiteData.Title.Longitude.Remove(Me.m_OnSiteData.Title.Longitude.Length - 1)
            If Me.m_OnSiteData.Title.Longitude.EndsWith("e") Or Me.m_OnSiteData.Title.Longitude.EndsWith("E") Then
                cobJd.Text = "E"
            Else
                cobJd.Text = "W"
            End If

            Me.txtLatitude.Text = Me.m_OnSiteData.Title.Latitude.Remove(Me.m_OnSiteData.Title.Latitude.Length - 1)
            If Me.m_OnSiteData.Title.Latitude.EndsWith("N") Or Me.m_OnSiteData.Title.Latitude.EndsWith("n") Then
                cobWd.Text = "N"
            Else
                cobWd.Text = "S"
            End If
            Me.m_OnSiteData.LocaleConcourse.CountTierData = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).ArrTierData.Length
            Dim sl As Integer = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length - 1
            Me.txtStartTime.Text = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Year & "年" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Month & "月" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Day & "日"
            Me.txtEndTime.Text = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Year & "年" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Month & "月" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Day & "日"

            Dim count As Integer = 0
            Dim time As String = ""
            Dim L As Integer = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).ArrTierData.Length
            Me.FlexLocaleWeather.Rows.Count = 1
            Me.FlexLocaleWeather.Rows.Count = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length + 1
            FlexLocaleWeather.Cols.Count = 3 + 6 * L
            For t As Integer = 0 To L - 1
                count = t * 6

                Me.FlexLocaleWeather.SetData(0, 3 + count, "第" & t + 1 & "层离地" & vbCrLf & "高度[m]")
                Me.FlexLocaleWeather.SetData(0, 4 + count, "第" & t + 1 & "层水平" & vbCrLf & "风向标差[度]")
                Me.FlexLocaleWeather.SetData(0, 5 + count, "第" & t + 1 & "层垂直" & vbCrLf & "风速标差[度]")
                Me.FlexLocaleWeather.SetData(0, 6 + count, "第" & t + 1 & "层" & vbCrLf & "温度[°C]")
                Me.FlexLocaleWeather.SetData(0, 7 + count, "第" & t + 1 & "层" & vbCrLf & "风向[度]")
                Me.FlexLocaleWeather.SetData(0, 8 + count, "第" & t + 1 & "层" & vbCrLf & "风速[m/s]")
            Next


            For i As Integer = 0 To Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length - 1
                Me.FlexLocaleWeather.SetData(i + 1, 0, i + 1)
                time = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Year & "-" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Month & "-" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Day
                Me.FlexLocaleWeather.SetData(i + 1, 1, time)
                Me.FlexLocaleWeather.SetData(i + 1, 2, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).Time)
                For j As Integer = 0 To Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData.Length - 1
                    count = j * 6
                    If Me.m_OnSiteData.LocaleConcourse.CountTierData > Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData.Length Then

                    Else
                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight = 9999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 3 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight = Nothing Then
                            Me.FlexLocaleWeather.SetData(i + 1, 3 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight <> 9999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 3 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).DistanceTerraHeight)
                        End If

                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane = -99 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 4 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane = Nothing Then
                            Me.FlexLocaleWeather.SetData(i + 1, 4 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane <> -99 Then

                            Me.FlexLocaleWeather.SetData(i + 1, 4 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).LevelWindVane)
                        End If
                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed = 99 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 5 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed = Nothing Then
                            Me.FlexLocaleWeather.SetData(i + 1, 5 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed <> 99 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 5 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).ApeakWindSpeed)
                        End If

                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature = -99 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 6 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature = Nothing Then
                            Me.FlexLocaleWeather.SetData(i + 1, 6 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature <> -99 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 6 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).Temperature)
                        End If

                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane = -999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 7 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane = Nothing Then

                            Me.FlexLocaleWeather.SetData(i + 1, 7 + count, "")

                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane <> -999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 7 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindVane)
                        End If
                        If Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed = -999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 8 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed = Nothing Then
                            Me.FlexLocaleWeather.SetData(i + 1, 8 + count, "")
                        ElseIf Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed <> -999 Then
                            Me.FlexLocaleWeather.SetData(i + 1, 8 + count, Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(i).ArrTierData(j).WindSpeed)
                        End If

                    End If

                Next
            Next
        End If





        FlexLocaleWeather.AutoResize = True
        FlexLocaleWeather.AutoSizeCols()
        FlexLocaleWeather.AutoSizeRows()


        Me.FlexLocaleWeather.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None
        Me.FlexLocaleWeather.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.None
        Me.FlexLocaleWeather.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.None
        Me.FlexLocaleWeather.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
    End Sub




    Private Sub FlexLocaleWeather_AfterEdit(ByVal sender As System.Object, ByVal e As C1.Win.C1FlexGrid.RowColEventArgs) Handles FlexLocaleWeather.AfterEdit
        Dim fp_row As Integer = 0
        Dim fp_col As Integer = 0

        Dim col As Integer = 0

        Dim p As Double = 0
        Dim d As String = ""
        fp_row = Me.FlexLocaleWeather.Row
        fp_col = Me.FlexLocaleWeather.Col
        col = Me.FlexLocaleWeather.Col

        If fp_row > 0 Then
            p = (fp_col - 2) / 6

            If p <= 1 Then

                If col = 3 Then
                    'Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).DistanceTerraHeight = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf col = 4 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).LevelWindVane = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf col = 5 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).ApeakWindSpeed = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf col = 6 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).Temperature = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf col = 7 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).WindVane = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf col = 8 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(0).WindSpeed = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                End If

            Else
                Dim s As String = CStr(p)
                If CDbl(s) = p Then
                    s = s - 1
                End If
                d = Mid(s, 1, 1)


                If (fp_col - 2) Mod 6 = 1 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).DistanceTerraHeight = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf (fp_col - 2) Mod 6 = 2 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).LevelWindVane = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf (fp_col - 2) Mod 6 = 3 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).ApeakWindSpeed = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf (fp_col - 2) Mod 6 = 4 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).Temperature = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf (fp_col - 2) Mod 6 = 5 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).WindVane = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                ElseIf (fp_col - 2) Mod 6 = 0 Then
                    Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(fp_row - 1).ArrTierData(d).WindSpeed = Me.FlexLocaleWeather.GetData(fp_row, fp_col)
                End If
            End If

        End If

    End Sub



    Private Sub TsbtnSaveFileLocale_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub btnOpenFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenFile.Click
        Me.OpenFileDialog1 = New OpenFileDialog()
        OpenFileDialog1.Filter = "现站气象数据文件(*.OQA)|*.OQA|All files (*.*)|*.*"
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
            Dim b As Integer = 0
            If OpenFileDialog1.FileName <> "" Then
                Me.m_OnSiteData.ImportData(OpenFileDialog1.FileName)
                
                ShowFlex()
            End If
        End If
    End Sub

    Private Sub btnSetTime_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSetTime.Click
        Dim fs As New frmSetupLocale
        fs.m_localeConcourse = Me.m_OnSiteData.LocaleConcourse
        ' fs.dateTstart .Value = 

        If fs.ShowDialog() = Windows.Forms.DialogResult.OK Then
            Me.m_OnSiteData.LocaleConcourse = fs.m_localeConcourse
            Dim sl As Integer = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData.Length - 1
            Me.txtStartTime.Text = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Year & "年" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Month & "月" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(0).Day & "日"
            Me.txtEndTime.Text = Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Year & "年" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Month & "月" & Me.m_OnSiteData.LocaleConcourse.ArrLocaleWeatherData(sl).Day & "日"


            ShowFlex()
        End If

    End Sub


    Private Sub txtLatitude_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtLatitude.Validating
        Try
            If Me.txtLatitude.Text = "" Or Me.txtLatitude.Text.Trim() = "" Then

                Exit Sub
            ElseIf CDbl(Me.txtLatitude.Text) < 1 Then

            End If

        Catch ex As Exception
            Me.txtLatitude.Text = ""
            MessageBox.Show("请正确输入，数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End Try
        Me.m_OnSiteData.Title.Latitude = txtLatitude.Text & cobWd.Text
    End Sub

    Private Sub cobWd_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles cobWd.Validating
        Me.m_OnSiteData.Title.Latitude = txtLatitude.Text & cobWd.Text
    End Sub

    Private Sub txtLongitude_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtLongitude.Validating
        Try
            If Me.txtLongitude.Text = "" Or Me.txtLongitude.Text.Trim() = "" Then
                Exit Sub
            ElseIf CDbl(Me.txtLongitude.Text) < 1 Then

            End If

        Catch ex As Exception
            Me.txtLongitude.Text = ""
            MessageBox.Show("请正确输入，数字！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End Try
        Me.m_OnSiteData.Title.Longitude = txtLongitude.Text & cobJd.Text
    End Sub

    Private Sub cobJd_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles cobJd.Validating
        Me.m_OnSiteData.Title.Longitude = txtLongitude.Text & cobJd.Text
    End Sub



    Private Sub btnSaveFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveFile.Click

        Dim saveFileDialog1 As New SaveFileDialog()

        saveFileDialog1.Filter = " 现场气象观测数据文件(*.OQA)|*.OQA"
        saveFileDialog1.FilterIndex = 2
        saveFileDialog1.RestoreDirectory = True
        saveFileDialog1.OverwritePrompt = True



        If txtLatitude.Text = Nothing Or txtLatitude.Text.Trim() = "" Then
            MessageBox.Show("纬度不能为空！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If
        If txtLongitude.Text = Nothing Or txtLongitude.Text.Trim() = "" Then
            MessageBox.Show("经度不能为空！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If

        If StringHandle.L_openFile <> 1 Then
            MessageBox.Show("不能保存，请打开文件，或设置数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If

        If saveFileDialog1.ShowDialog() = DialogResult.OK Then
            Me.m_OnSiteData.ExportData(saveFileDialog1.FileName)
        End If
    End Sub

    Private Sub cmd_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_OK.Click
        Me.DialogResult = Windows.Forms.DialogResult.OK
        Me.Close()
    End Sub

    Private Sub cmd_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Cancel.Click
        Me.DialogResult = Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub
End Class